fn main() -> iced::Result {
    iced::run("title", Counter::increment, Counter::view)
}
fn update(counter: &mut u64, message: Message) {
    match message {
        Message::Increment => *counter += 1,
    }
}

use std::cell::Cell;

use iced::widget::{button, text};
use iced::Element;

#[derive(Debug, Clone)]
enum Message {
    Increment,
}

#[derive(Debug, Clone, Default)]
struct Counter {
    value: Cell<usize>,
}

impl Counter {
    fn increment(&mut self, message: Message) {
        self.value.set(self.value.get() + 1);
    }

    fn view(&self) -> Element<Message> {
        button(text(self.value.get()))
            .on_press(Message::Increment)
            .into()
    }
}
